//<!-- 支付统计报表 -->
export default {
  data () {
    return {
      parkNameListRow: {
        searchParams:{},
        pageNumber:1,
        total: 0,
        theadsInfo: [
          { index: 0, isShow: false, prop: 'reno', text: '序号', width: 68 },
          { index: 1, isShow: false, prop: 'm', text: '停车场', minWidth: 110 }
        ],
        tbodysInfo: []
      },
      parkNameRow:{},
      originOtherData: {
        list: []
      },
      modeOtherData: {
        list: []
      }
    }
  },
  created () {
    
  },
  methods: {
    // 重新生成按钮
    reBuild(){
      this.$refs.myReBuildBtn.reBuild()
    },
    getList () {
      let params = $.extend({}, this.searchParams, this.otherParams);
      this.getParkPaymentReportList(params);
    },
    getParkPaymentReportList (aparams) {//查询列表
      let self = this,
          params = {
            page: this.pageNumber,
            rp: this.pageSize
          };
      params = $.extend({}, params, aparams);

      switch (params.reportDimension) {
          case 'day':
              //params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY-MM-DD').startOf('day').format('YYYY-MM-DD HH:mm:ss');
              //params['reportDateTo'] = moment(params.reportDateTo, 'YYYY-MM-DD').endOf('day').format('YYYY-MM-DD HH:mm:ss');
              break;
          case 'month':
              params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY-MM').startOf('month').format('YYYY-MM-DD HH:mm:ss');
              params['reportDateTo'] = moment(params.reportDateTo, 'YYYY-MM').startOf('month').format('YYYY-MM-DD 00:00:00');
              break;
          case 'year':
              params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY').startOf('year').format('YYYY-MM-DD HH:mm:ss');
              params['reportDateTo'] = moment(params.reportDateTo, 'YYYY').startOf('year').format('YYYY-MM-DD 00:00:00');
              break;
          case 'custom':
              params['reportDateFrom'] = params.reportDateFrom;
              params['reportDateTo'] = params.reportDateTo;
              break;
          default:
      }


      API.report.GetParkPaymentReportData(params)
          .then(res => {
            let data = res.data,
                list = data.rows;
            self.tbodysInfo = list;
            self.total = data.total;
          }, err => {})
    },
    exportData(){//导出
      let self = this;
      this.showDialog("是否确认导出记录？",[],function(){
        let params = {
        };
        params = $.extend({}, params, self.searchParams, self.otherParams);

        switch (params.reportDimension) {
          case 'day':
              //params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY-MM-DD').startOf('day').format('YYYY-MM-DD HH:mm:ss');
              //params['reportDateTo'] = moment(params.reportDateTo, 'YYYY-MM-DD').endOf('day').format('YYYY-MM-DD HH:mm:ss');
              break;
          case 'month':
              params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY-MM').startOf('month').format('YYYY-MM-DD HH:mm:ss');
              params['reportDateTo'] = moment(params.reportDateTo, 'YYYY-MM').startOf('month').format('YYYY-MM-DD 00:00:00');
              break;
          case 'year':
              params['reportDateFrom'] = moment(params.reportDateFrom, 'YYYY').startOf('year').format('YYYY-MM-DD HH:mm:ss');
              params['reportDateTo'] = moment(params.reportDateTo, 'YYYY').startOf('year').format('YYYY-MM-DD 00:00:00');
              break;
          case 'custom':
              params['reportDateFrom'] = params.reportDateFrom;
              params['reportDateTo'] = params.reportDateTo;
              break;
          default:
        }

        self.toExportAsync('/report/payment/export.do', params);
      },"温馨提示",function(){
        //取消时不操作
      });
    },
    openOriginOther(row,modalName){
      this.originOtherData.list=[];
      this.originOtherData.list.push({name:"支付宝小程序",count:row.originAlipaySmallAppCountStr,amount:row.originAlipaySmallAppAmountStr});
      this.originOtherData.list.push({name:"微信小程序",count:row.originWeixinSmallAppCountStr,amount:row.originWeixinSmallAppAmountStr});
      this.originOtherData.list.push({name:"AOMP",count:row.originAompCountStr,amount:row.originAompAmountStr});
      this.originOtherData.list.push({name:"VEMS",count:row.originVemsCountStr,amount:row.originVemsAmountStr});
      this.originOtherData.list.push({name:"POMP",count:row.originBackEndCountStr,amount:row.originBackEndAmountStr});
      this.originOtherData.list.push({name:"H5",count:row.originHtml5CountStr,amount:row.originHtml5AmountStr});
      this.originOtherData.list.push({name:"线上支付",count:row.originOnlineCountStr,amount:row.originOnlineAmountStr});
      this.originOtherData.list.push({name:"移动APP",count:row.originAppCountStr,amount:row.originAppAmountStr});
      this.originOtherData.list.push({name:"移动POS",count:row.originPosCountStr,amount:row.originPosAmountStr});
      this.originOtherData.list.push({name:"平板",count:row.originPadCountStr,amount:row.originPadAmountStr});
      this.originOtherData.list.push({name:"未知",count:row.originUnknowCountStr,amount:row.originUnknowAmountStr});
      // this.originOtherData.list.push({name:"微信",count:row.originWeixinCountStr,amount:row.originWeixinAmountStr});
      // this.originOtherData.list.push({name:"支付宝",count:row.originAlipayCountStr,amount:row.originAlipayAmountStr});
      this.toOpenModal(modalName);
    },
    openModeOther(row,modalName){
      this.modeOtherData.list = [];
      this.modeOtherData.list.push({name:"银联无感支付",count:row.modeUnionWithoutSenseCountStr,amount:row.modeUnionWithoutSenseAmountStr});
      // this.modeOtherData.list.push({name:"支付宝无感支付",count:row.modeAlipayWithoutSenseCountStr,amount:row.modeAlipayWithoutSenseAmountStr});
      // this.modeOtherData.list.push({name:"微信无感支付",count:row.modeWechatWithoutSenseCountStr,amount:row.modeWechatWithoutSenseAmountStr});
      this.modeOtherData.list.push({name:"手动转账",count:row.modeHandTransferCountStr,amount:row.modeHandTransferAmountStr});
      this.modeOtherData.list.push({name:"ETC",count:row.modeEtcCountStr,amount:row.modeEtcAmountStr});
      this.modeOtherData.list.push({name:"腾讯无感支付",count:row.modeTencentNotPwCountStr,amount:row.modeTencentNotPwAmountStr});
      // this.modeOtherData.list.push({name:"支付宝免密支付",count:row.modeAlipayNotPwCountStr,amount:row.modeAlipayNotPwAmountStr});
      // this.modeOtherData.list.push({name:"微信免密支付",count:row.modeWixinNotPwCountStr,amount:row.modeWixinNotPwAmountStr});
      this.modeOtherData.list.push({name:"信用卡",count:row.modeCreditCountStr,amount:row.modeCreditAmountStr});
      this.modeOtherData.list.push({name:"普通储蓄卡",count:row.modeCommonBankCountStr,amount:row.modeCommonBankAmountStr});
      this.modeOtherData.list.push({name:"NFC",count:row.modeNfcCountStr,amount:row.modeNfcAmountStr});
      this.modeOtherData.list.push({name:"第三方余额",count:row.modeThirdBalanceCountStr,amount:row.modeThirdBalanceAmountStr});
      this.modeOtherData.list.push({name:"银联网络支付",count:row.modeUnionNetPayCountStr,amount:row.modeUnionNetPayAmountStr});
      this.modeOtherData.list.push({name:"银联接触卡",count:row.modeUnionTouchPayCountStr,amount:row.modeUnionTouchPayAmountStr});
      this.modeOtherData.list.push({name:"账户余额",count:row.modeBalanceCountStr,amount:row.modeBalanceAmountStr});
      this.modeOtherData.list.push({name:"免费",count:row.modeFreeCountStr,amount:row.modeFreeAmountStr});
      this.modeOtherData.list.push({name:"交通卡",count:row.modeTrafficCardCountStr,amount:row.modeTrafficCardAmountStr});
      this.modeOtherData.list.push({name:"银联闪付",count:row.modeUnionpayQuickCountStr,amount:row.modeUnionpayQuickAmountStr});
      this.modeOtherData.list.push({name:"次数",count:row.modeTimesCountStr,amount:row.modeTimesAmountStr});
      this.modeOtherData.list.push({name:"自发卡",count:row.modeSelfCardCountStr,amount:row.modeSelfCardAmountStr});
      this.modeOtherData.list.push({name:"未定义",count:row.modeUnknowCountStr,amount:row.modeUnknowAmountStr});
      this.toOpenModal(modalName);
    },
    filterMultiCheck (selectionArr) {//必须定义获取多列的方法
      let result = [];
        selectionArr.map((item)=>{
          result.push(item.id);
        });
      return result;
    },
  }
}